import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 院系信息信息 */
export interface Department {
          deptId: number; // 院系ID
          deptName?: string; // 院系名称
          deptCode?: string; // 院系编码
          deptHeadId: number; // 院系负责人ID
          contactPhone: string; // 联系电话
          officeLocation: string; // 办公地点
          description: string; // 院系描述
          status?: number; // 状态（0正常 1停用）
  }

// 院系信息 API
export const DepartmentApi = {
  // 查询院系信息分页
  getDepartmentPage: async (params: any) => {
    return await request.get({ url: `/ao/department/page`, params })
  },

  // 查询院系信息简化列表
  getSimpleDepartmentList: async (): Promise<Department[]> => {
    return await request.get({ url: `/ao/department/simple-list` })
  },

  // 查询院系信息详情
  getDepartment: async (id: number) => {
    return await request.get({ url: `/ao/department/get?id=` + id })
  },

  // 新增院系信息
  createDepartment: async (data: Department) => {
    return await request.post({ url: `/ao/department/create`, data })
  },

  // 修改院系信息
  updateDepartment: async (data: Department) => {
    return await request.put({ url: `/ao/department/update`, data })
  },

  // 删除院系信息
  deleteDepartment: async (id: number) => {
    return await request.delete({ url: `/ao/department/delete?id=` + id })
  },

  /** 批量删除院系信息 */
  deleteDepartmentList: async (ids: number[]) => {
    return await request.delete({ url: `/ao/department/delete-list?ids=${ids.join(',')}` })
  },

  // 导出院系信息 Excel
  exportDepartment: async (params) => {
    return await request.download({ url: `/ao/department/export-excel`, params })
  },
}
